<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMenusTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('parent_id')->nullable()->comment('父级ID');
            $table->string('name')->comment('菜单名称');
            $table->string('path')->comment('菜单路径');
            $table->string('url')->comment('完整路径');
            $table->string('icon')->nullable()->comment('菜单图标');
            $table->string('target')->nullable()->comment('目标，path为url时可用(_blank等)');
            $table->unsignedTinyInteger('hide_menu')->default(0)->comment('是否隐藏，0:否,1:是');
            $table->unsignedTinyInteger('hide_breadcrumb')->default(0)->comment('是否隐藏面包屑，0:否,1:是');
            $table->unsignedInteger('level')->default(1)->comment('层级，可选1,2,3，最大到3');
            $table->unsignedInteger('sort')->default(1)->comment('排序');
            $table->unsignedTinyInteger('child_number')->default(0)->comment('子节点数量');
            $table->string('identity')->default('true')->comment('菜单权限');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '菜单表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }

}
